﻿/*
 * 文件名：ClassInfo.cs
 * 类名：XHCTMS.DAL.ClassInfo
 * 创建人：季崇华  
 * 创建时间：2013-5-21
 * 
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace XHCTMS.BLL
{
    /// <summary>
    /// 班级实体类操作
    /// </summary>
    public class Class
    {
        /// <summary>
        /// 增加班级
        /// </summary>
        /// <param name="classinfo">班级</param>
        /// <returns>返回类型：int 成功/大于0 失败/0 异常/-1</returns>
        public int Add(MODEL.Class Class)
        {
            return new DAL.Class().Add(Class);
        }

        /// <summary>
        /// 删除班级（班级毕业同时要让班级与学生都设置为毕业状态）
        /// </summary>
        /// <param name="classid">班级号</param>
        /// <returns>返回类型:int 1/成功 0/失败 -1/异常</returns>
        public int Delete(int classid)
        {
            return new DAL.Class().Delete(classid);
        }


        /// <summary>
        /// 按班级号修改班级
        /// </summary>
        /// <param name="class">要修改的信息和班级号</param>
        /// <returns>返回类型:int 成功/大于0 失败/0 异常/-1</returns>
        public int Update(int ClassId, MODEL.Class Class)
        {
            return new DAL.Class().Update(ClassId, Class);
        }

        /// <summary>
        /// 分页获取班级信息
        /// </summary>
        /// <param name="PageIndex">页面大小</param>
        /// <param name="PageSize">当前页号</param>
        /// <returns>返回类型：int 1/成功, 0/失败, -1/异常</returns>
        public DataTable Formation(int PageIndex=1,int PageSize=50 )
        {
            return new DAL.Class().Formation(PageIndex, PageSize);
        }
        /// <summary>
        /// 通过专业名。得到所有专业下的班级
        /// </summary>
        /// <param name="subName"></param>
        /// <returns></returns>
        public DataTable GetClassName()
        {
            return new DAL.Class().GetClassName();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="parasValue">" class_name =", " sub_name =", " [user_name] ="," dep_name" </param>
        /// <param name="PageIndex"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        public DataTable Search(string className, string subName ,string userName,string depName,string classFlag, int PageIndex = 1, int PageSize = 50)
        {
            string[] parasValue = { className, subName, userName, depName, classFlag };
            return new DAL.Class().Search(parasValue);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="parasValue"></param>
        /// <returns></returns>
        public DataTable Search(string[] parasValue,int page =1)
        {
            return new DAL.Class().Search(parasValue,page);
        }


        /// <summary>
        /// 获得满足条件的所有数据量
        /// </summary>
        /// <param name="parasValue"></param>
        /// <returns></returns>
        public int MaxPage(string[] parasValue)
        {
            return new DAL.Class().MaxPage(parasValue);
        }


        
        /// <summary>
        /// 根据班级号得到班级状态
        /// </summary>
        /// <param name="classID"></param>
        /// <returns></returns>
        public string GetClassFlag(int classID)
        {
            return new DAL.Class().GetClassFlag(classID);
        }

        public DataTable GetAllClassName()
        {
            return new DAL.Class().GetAllClassName();
        }

        
        /// <summary>
        /// 班主任获取所带的班级名
        /// </summary>
        /// <param name="classTeaID"></param>
        /// <returns></returns>
        public DataTable ClassTeaGetClassName(int classTeaID)
        {
            return new DAL.Class().ClassTeaGetClassName(classTeaID);
        }

    }
}
